//获取应用实例
let app = getApp();
let httptool=require("../../../utils/zry.httptool.js");
Page({
  data:{
    historyScore:[],//历史成绩数组
    bestScore:{},//最高成绩
    msgprop:'',//消息提示 
    noData: false,
  },
  onLoad:function(options){
    // 页面初始化 options为页面跳转所带来的参数
    let that=this;
    that.getHistoryScore();
  },
  getHistoryScore:function(e){//获取历史成绩列表
    let that=this;
    let UserId=app.getStorage('customerId');
     httptool.ajaxPost("api/BoxRecord/GetBoxHisRecords", {UserId:UserId}, function (res) {
        if (res.suc) {
          let data = app.notNull(res.data, []);
          if(data.length>0){
            for(let i=0;i<data.length;i++){
              if(data[i].BoxQty<10){
                data[i].BoxQty='0'+data[i].BoxQty;
              }
            }
            that.setData({bestScore:data[0],noData: data.length == 0});            
            data.splice(0,1);//删除数组的一个元素
            that.setData({historyScore: data});
          }else{
             that.setData({ noData: true });
          }
         
        } else {
          app.showNotify(that, res.msg);
        }
      });
  },
})